package com.fire.market.controller;

import com.fire.component.dto.SingleResponse;
import com.fire.component.extension.Assert;
import com.fire.market.order.api.dto.OrderInfo;
import com.fire.market.order.api.request.OrderCreateParam;
import com.fire.market.order.api.service.OrderCmdFrontService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("order/cmd")
@Api(tags = "订单Cmd操作")
public class OrderCmdController extends BaseController{
    @Reference
    private OrderCmdFrontService orderCmdFrontService;

    //创建订单
    @PostMapping(value = "create")
    @ApiOperation(value = "创建订单", notes = "创建订单")
    public SingleResponse<OrderInfo> createOrder(@RequestBody OrderCreateParam param){
        Assert.notNull(param, "OrderCreateParam is null");
        return SingleResponse.of(orderCmdFrontService.createOrder(param).getData());
    }
}
